﻿using System;
using System.Collections.Generic;
using System.Web;
using System.Collections;
using System.Data;
using CE.Database;

/// <summary>
/// Summary description for CCAllCardsDB
/// </summary>
/// 
namespace CE.CreditCard
{
    public class CCAllCardsDB
    {
        public CCAllCardsDB()
        {
            //
            // TODO: Add constructor logic here
            //
        }
        public DataSet GetCCAllCardsDetails(Int32 CardClass, Int32 OrderByType, Int32 NoofItem)
        {
            DataSet _dsAllCards = null;
            MyDatabase _db = new MyDatabase();
            string _spName = "sprocCCSelectCardsList";

            SortedList _spara = new SortedList();
            _spara.Add("@CCClass", CardClass);
            _spara.Add("@OrderByType", OrderByType);
            _spara.Add("@NoofItem", NoofItem);

            using (DataSet _ds = _db.GetDataSet(_spName, _spara))
            {
                if (_ds != null && _ds.Tables[0].Rows.Count > 0)
                {
                    _dsAllCards = new DataSet();
                    _dsAllCards = _ds;
                }
            }
            return _dsAllCards;
        }

        public Int64 Insert(CCAllCards _ccallcards)
        {
            MyDatabase _db = new MyDatabase();
            Int64 _result = -1;
            string _spName = "sprocCCCApplicantWithoutRequestInsertSingleItem";
            SortedList _sPara = new SortedList();

            _sPara.Add("@CCCAppReqId", _ccallcards.CCCAppReqId);
            _sPara.Add("@RefCEUserId", _ccallcards.RefCEUserId);
            _sPara.Add("@EmailAddress", _ccallcards.EmailAddress);
            _sPara.Add("@FullName", _ccallcards.FullName);
            _sPara.Add("@MobileNo", _ccallcards.MobileNo);
            _sPara.Add("@DOB", _ccallcards.DOB);
            _sPara.Add("@ApplicantIdType", _ccallcards.IdType);
            _sPara.Add("@CardClass", _ccallcards.CardClass);
            _sPara.Add("@ViewedDetailId", _ccallcards.ViewedDetailId);

            _result = _db.ExecuteSP(_spName, _sPara);

            return _result;
        }

    }
}